#include #include using namespace std; struct rank { int index; int first; int second; }; bool less_rank(rank A, rank B) { if(A.first == B.first) return A.second < B.second; else return A.first < B.first; } const int max_n = 100000+5; const int max_l = 18; int len,steps; char str[max_n]; int P[max_l][max_n]; rank R[max_n]; void manber_myers() { int count; for(len=0; str[len] != '\0'; ++len) P[0][len] = str[len]; for(steps=1,count=1; count>>1 < len; steps++,count<<=1) { for(int i=0; i=0 && i